home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20020314-20021006
/
000357_fdc@columbia.edu_Thu Sep 12 10:16:34 EDT 2002.msg
< prev
next >
Wrap
Text File
|
2002-10-06
|
3KB
|
74 lines
Article: 13689 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.os.linux.misc,comp.protocols.kermit.misc
Subject: Re: Serial port scripting
Date: 12 Sep 2002 09:51:50 -0400
Organization: Columbia University
Lines: 57
Message-ID: <alq65m$rqh$1@watsol.cc.columbia.edu>
References: <3D7F5E0E.D5370A8C@arcoide.com> <eMKf9.1183$VM7.322810980@newssvr12. <3D7F9578.86E64588@arcoide.com> <6bb688813ba3e707c91e156a8a0b9004@remailer.privacy.at>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1031838711 1400 128.59.39.139 (12 Sep 2002 13:51:51 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 12 Sep 2002 13:51:51 GMT
Xref: newsmaster.cc.columbia.edu comp.os.linux.misc:562263 comp.protocols.kermit.misc:13689
In article <6bb688813ba3e707c91e156a8a0b9004@remailer.privacy.at>,
Anonymous <nobody@remailer.privacy.at> wrote:
: Gary <gary@arcoide.com>:
: > I don't know that it'll help you but I have a device that
: > has it's own serial port (a Max232) setup to send a byte of
: > data every X seconds at 96,n,8,1, or alternately respond to
: > put out the data after the Max232 receives a 55h.
: >
: > I need to setup the comm protocols to the above on the PC
: > serial port, send 55h, and then read the byte sent back.
: >
: > The data should never change after the first "valid" read.
: >
: > In the PC/DOS world I could write it in assembler, but need
: > Linux and a script.
:
: This sounds like a job for 'kermit'. Go to the Kermit Web site:
:
: http://www.columbia.edu/kermit/
:
: and download the sources, or find a binary package for your
: distribution. A 10-line kermit script should be sufficient.
:
Kermit for Linux is here:
http://www.columbia.edu/kermit/ckermit.html
Binaries are here:
http://www.columbia.edu/kermit/ck80binaries.html
Here is a script to read one byte from a serial port:
set port /dev/ttyS0 ; or whatever
if fail stop 1 "Can't open port"
set speed 9600 ; or whatever
set carrier-watch off ; if device does not assert CD
set flow none ; if device does not assert CTS
input -1 ; wait forever for one byte
if fail stop 1 "INPUT Failed"
echo INPUT GOT: \fhexify(\v(inchar))
To send hex 55, use:
output \x55
To place a time limit on the INPUT command, replace "-1" with
a positive number (of seconds to wait).
Embellish as desired for looping, error checking, report
writing, statistics gathering, calculation, etc. See:
http://www.columbia.edu/kermit/ckscripts.html
for examples.
- Frank